package com.lyx.TestList;

import com.lyx.list.TestList;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Vector;

/**
 * ArrayList不唯一，有顺序
 */
public class TestArrayList {


    public static void main(String[] args) {


        ArrayList<Integer> arrayList = new ArrayList<Integer>();

        Vector vector = new Vector();

        vector.addElement(1);


        ArrayList list = new ArrayList();
        arrayList.toString();
        arrayList.add(12);
        arrayList.add(34);
        arrayList.add(6);
        arrayList.add(3);
        arrayList.add(66);
        arrayList.add(25);
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(6);
        arrayList.add(3);
        arrayList.add(4);
        arrayList.add(2);
        arrayList.add(6);
        arrayList.add(3);
        arrayList.add(4);
        arrayList.add(4);


        arrayList.get(0);
        arrayList.remove(0);
        arrayList.set(0,2);
        System.out.println(10 + 10 >> 1);
//        Integer[] a = new Integer[8];
//        Integer[] b = arrayList.toArray(a);
//        arrayList.toString();
        System.out.println(arrayList.size());
        //System.out.println(Arrays.toString(b));

        Iterator<Integer> it = arrayList.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
    }

    class Meal{
        Meal(){
            System.out.println("Meal()");
        }
    }
    class Bread{
        public Bread() {
            System.out.println("Bread()");
        }
    }
    class Cheese{
        public Cheese() {
            System.out.println("Cheese()");
        }
    }

    class Lettuce{
        public Lettuce() {
            System.out.println("Lettuce()");

        }
    }
    class Lunch extends Meal{
        public Lunch() {
            System.out.println("Lunch()");

        }
    }

    class PortableLunch extends Lunch{
        public PortableLunch() {
            System.out.println("PortableLunch()");

        }
    }
    class Sandwich extends PortableLunch{

        Bread b = new Bread();
        Cheese c = new Cheese();
        Lettuce l = new Lettuce();
        Sandwich(){
            System.out.println("Sandwich()");

        }


    }
}
